// src/users/users.entity.ts
import {
  Entity,
  PrimaryGeneratedColumn,
  Column,
  CreateDateColumn,
  UpdateDateColumn,
} from 'typeorm';

@Entity('users')
export class User {
  @PrimaryGeneratedColumn()
  id: number;

  @Column({ nullable: true })
  phone: string;

  @Column('varchar', { length: 255, nullable: true })
  password: string;

  @Column({ nullable: true })
  name: string;

  @Column({ nullable: true })
  email: string;

  @Column({ nullable: true })
  googleId: string;

  @Column({ nullable: true })
  facebookId: string;

  @Column({ nullable: true })
  wechatId: string;

  @Column({ nullable: true })
  avatar: string;

  // 新增的个人资料字段
  @Column({ nullable: true })
  nickname: string;

  @Column({ type: 'timestamp', nullable: true })
  birthday: Date | null;

  @Column({ nullable: true })
  gender: string;

  @Column('simple-array', { nullable: true })
  photos: string[];

  @Column({ nullable: true })
  introduction: string;

  @Column({ nullable: true })
  personality: string;

  @Column({ nullable: true })
  purpose: string;

  @Column({ nullable: true })
  height: number;

  @Column({ nullable: true })
  occupation: string;

  @Column({ nullable: true })
  education: string;

  @Column({ nullable: true })
  school: string;

  @Column({ nullable: true })
  from: string;

  @Column({ nullable: true })
  pet: string;

  @Column({ type: 'jsonb', nullable: true })
  lifestyle: {
    fitness: boolean;
    drinking: boolean;
    smoking: boolean;
  };

  @Column({ type: 'jsonb', nullable: true })
  assets: any;

  @Column('simple-array', { nullable: true })
  tags: string[];

  // 添加位置信息字段
  @Column({ type: 'decimal', precision: 10, scale: 8, nullable: true })
  latitude: number;

  @Column({ type: 'decimal', precision: 11, scale: 8, nullable: true })
  longitude: number;

  @Column({ nullable: true })
  location: string;

  // 添加粉钻字段
  @Column({ name: 'diamonds', type: 'int', default: 0 })
  diamonds: number;

  // 添加VIP状态字段
  @Column({ name: 'is_vip', type: 'boolean', default: false })
  isVip: boolean;

  @Column({ name: 'vip_end_time', type: 'timestamp', nullable: true })
  vipEndTime: Date;

  // 根据您提供的表结构新增字段
  @Column({ nullable: true })
  provider: string;

  @Column({ name: 'provider_user_id', nullable: true })
  providerUserId: string;

  @Column({ name: 'email_verified', type: 'boolean', default: false })
  emailVerified: boolean;

  @Column({ name: 'access_token', nullable: true })
  accessToken: string;

  @Column({ name: 'refresh_token', nullable: true })
  refreshToken: string;

  @Column({ name: 'token_expiry', type: 'timestamp', nullable: true })
  tokenExpiry: Date;

  @CreateDateColumn({ name: 'created_at' })
  createdAt: Date;

  @UpdateDateColumn({ name: 'updated_at' })
  updatedAt: Date;

  // 新增字段：兴趣爱好
  @Column('simple-array', { nullable: true })
  interests: string[];

  // 新增字段：关系目的
  @Column({ nullable: true })
  relationship_goal: string;

  // 新增字段：语言
  @Column('simple-array', { nullable: true })
  languages: string[];

  // 新增字段：母语
  @Column({ nullable: true })
  mother_tongue: string;

  // 新增字段：国籍
  @Column({ nullable: true })
  nationality: string;
}